package edu.scau.misp.backend_module.service.impl;

import edu.scau.misp.backend_module.domain.Table;
import edu.scau.misp.backend_module.mapper.TableMapper;
import edu.scau.misp.backend_module.service.ITableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class TableServiceImpl implements ITableService {
    @Autowired
    private TableMapper tableMapper;
    /**
     * 根据ID查询table
     *
     * @param tableId
     * @return
     */
    @Override
    public Table getTableById(Long tableId) {
        return tableMapper.getTableById(tableId);
    }

    /**
     * 列出所有table
     *
     * @return
     */
    @Override
    public List<Table> listAllTable() {
        return tableMapper.listAllTable();
    }

    /**
     * 根据table模糊查询
     *
     * @param table
     * @return
     */
    @Override
    public List<Table> selectTableList(Table table) {
        return tableMapper.selectTableList(table);
    }

    /**
     * 增加新的table
     *
     * @param table
     * @return
     */
    @Override
    public int insertTable(Table table) {
        return tableMapper.insertTable(table);
    }

    /**
     * 修改table
     *
     * @param table
     * @return
     */
    @Override
    public int updateTable(Table table) {
        return tableMapper.updateTable(table);
    }

    /**
     * 删除table
     *
     * @param tableId
     * @return
     */
    @Override
    public int deleteTableById(Long tableId) {
        return tableMapper.deleteTableById(tableId);
    }
}
